<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/6/14
 * Time: 17:30
 */
//var_dump($_GET);
$jsApiParameters=$_GET['jsApiParameters'];
$editAddress=$_GET['editAddress'];
$goods_name=$_GET['goods_name'];
$goods_price=$_GET['goods_price'];
//var_dump($editAddress);
//var_dump($jsApiParameters);

?>
<!DOCTYPE html>
<html>
<head>
    <title>成长游微信支付</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="wxzf.css">
    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                <?php echo $jsApiParameters; ?>,
                function(res){
                    WeixinJSBridge.log(res.err_msg);
                   /* alert(res.err_code+res.err_desc+res.err_msg);*/
                }
            );
        }

        function callpay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }
    </script>
    <script type="text/javascript">
        //获取共享地址
        function editAddress()
        {
            WeixinJSBridge.invoke(
                'editAddress',
                <?php echo $editAddress; ?>,
                function(res){
                    var value1 = res.proviceFirstStageName;
                    var value2 = res.addressCitySecondStageName;
                    var value3 = res.addressCountiesThirdStageName;
                    var value4 = res.addressDetailInfo;
                    var tel = res.telNumber;

                    /*alert(value1 + value2 + value3 + value4 + ":" + tel);*/
                }
            )
        }

        window.onload = function(){
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', editAddress, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', editAddress);
                    document.attachEvent('onWeixinJSBridgeReady', editAddress);
                }
            }else{
                editAddress();
            }
        };

    </script>
</head>
<body>

<div class="wenx_xx">
    <div class="mz">成长游微信商城</div>
    <div class="wxzf_price">￥<?php echo $goods_price ?></div>
</div>
<div class="skf_xinf">
    <div class="all_w"> <span class="bt">收款方</span> <span class="fr">成长游</span> </div>
</div>
<div class="skf_xinf">
    <div class="all_w"> <span class="bt">商品名称</span> <span class="fr"><?php echo $goods_name ?></span> </div>
</div>
<a href="javascript:void(0);" class="ljzf_but all_w" onclick="callpay()">立即支付</a>


</body>
</html>
